package com.wayhome.springfarmework.context.support;

import com.wayhome.springfarmework.beans.factory.support.DefaultListableBeanFactory;
import com.wayhome.springfarmework.beans.factory.xml.XmlBeanDefinitionReader;

import java.io.IOException;

public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {

    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory factory) throws IOException {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(factory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations)
            beanDefinitionReader.loadBeanDefinitions(configLocations);
    }

    protected abstract String[] getConfigLocations();
}
